#include "gtest\gtest.h"
#include "..\SP\SP.h"

using namespace SP;

class PipelineTest
	:public ::testing::Test
{
protected:

};

struct Vertex
{
	SPVector3 pos;
	SPColor color;
};

TEST_F(PipelineTest, TestDraw)
{
	Vertex* vertices = new Vertex[3];
	vertices[0].pos = SPVector3(0.0f, 0.0f, 1.0f);
	vertices[0].color = SPColor(255, 0, 0, 255);
	vertices[1].pos = SPVector3(1.0f, 0.0f, 1.0f);
	vertices[1].color = SPColor(255, 0, 0, 255);
	vertices[2].pos = SPVector3(0.0f, 1.0f, 1.0f);
	vertices[2].color = SPColor(255, 0, 0, 255);

	SPVector3 eye(0.0f, 0.0f, -1.0f);
	SPVector3 at(0.0f, 0.0f, 0.0f);
	SPVector3 up(0.0f, 1.0f, 0.0f);

	SPMatrix vMatrix = SPMatrix::getViewTransformMatrix(eye, at, up);
	SPMatrix pMatrix = SPMatrix::getPerspectiveMatrix(1.57f, 3.0f / 4.0f, 1.0f, 10.0f);
	SPMatrix tansformMatrix = vMatrix * pMatrix;
	Pipeline pipeline;
	pipeline.setInputVertex(vertices, 3);
	pipeline.setTransformMatrix(tansformMatrix);
	pipeline.draw(PRIMITIVE_TRIANGLE);
}